<div id="titulo_azul">
    <span><?php __('Licencias'); ?></span>
</div>
<div id="contenido_gral">
    <?php
    if (!empty($licenses)) {
        ?>
        <table cellpadding="0" cellspacing="0" id="tabla_gral">
            <tr>
                <th>&nbsp;</th>
                <th><?php __('Usuario'); ?></th>
                <th><?php __('Motivo'); ?></th>
                <th><?php __('Período'); ?></th>
                <th><?php __('Días'); ?></th>
                <th><?php __('Horario'); ?></th>
            </tr>
            <?php
            $i = 0;
            foreach ($licenses as $license):
                $class = null;
                if ($i++ % 2 == 0) {
                    $class = ' class="altrow"';
                }
                ?>
                <tr<?php echo $class; ?>>
                    <td width="30">
                        <?php
                        echo $this->Html->link(
                                $this->Html->image("/images/ic_menu_delete.png", array('alt' => 'Borrar', 'title' => 'Borrar', 'width' => '15')), "/licenses/delete/" . $license['License']['id'], array('escape' => false), "¿Confirma la eliminación de la Licencia " . $license['License']['name'] . "?"
                        );
                        ?>
                    </td>
                    <td><?php echo $license['User']['lastname'] . " " . $license['User']['name']; ?>&nbsp;</td>
                    <td><?php echo $license['License']['name']; ?>&nbsp;</td>
                    <td><?php echo date('d/m/Y', strtotime($license['License']['fecha_desde'])) . " - " . date('d/m/Y', strtotime($license['License']['fecha_hasta'])) ?></td>
                    <td><?php if (empty($license['Day']['name'])) {
                    echo "Todos";
                } else {
                    echo $license['Day']['name'];
                } ?></td>
                    <td><?php echo $license['License']['hora_desde'] . " - " . $license['License']['hora_hasta']; ?>&nbsp;</td>
                </tr>
            <?php endforeach; ?>
        </table>
        <?php
    } else {
        echo "No se registran datos...<br/>";
    }
    ?>
    <br/><a href="javascript:MostrarModal('ventana_modal','Carga de Licencia','/licenses/add/',450,600)" class="btn btn-warning">Asociar una Licencia</a>
</div>